package com.ad.pet.app.shopcar.adapter;

import android.graphics.Paint;
import android.support.annotation.Nullable;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ad.pet.R;
import com.ad.pet.common.data.utils.SpUtil;
import com.ad.pet.constant.Constant;
import com.ad.pet.models.remote.cart.ShippingWay;

import java.util.List;

/**
 * Created by SEELE on 2019/6/1.
 */

public class ShippingWayAdapter extends BaseQuickAdapter<ShippingWay, BaseViewHolder> {


    public ShippingWayAdapter(@Nullable List<ShippingWay> data) {
        super(R.layout.item_shipingway_layout, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ShippingWay item) {
        ImageView mTvCheck = helper.getView(R.id.tv_check);
        TextView tv_way_name = helper.getView(R.id.tv_way_name);
        TextView tv_price = helper.getView(R.id.tv_price);
        TextView tv_way_say = helper.getView(R.id.tv_way_say);
        TextView tvLine = helper.getView(R.id.tv_line);


        if (item.isCheck()){
            mTvCheck.setImageResource(R.drawable.ic_chose);
        }else {
            mTvCheck.setImageResource(R.drawable.ic_unchose);

        }


        tv_way_name.setText(item.getDelivery_time());
        tv_price.setText(item.getFreight_txt());

        if (!item.getFreight_usd_text().equals(item.getFreight_usd())){
            tv_way_say.setPaintFlags(Paint.STRIKE_THRU_TEXT_FLAG);
        }

        tv_way_say.setText(SpUtil.getInstance().getString(Constant.CURRENCY_LABEL)+item.getFreight_usd_text());
        tvLine.setText(item.getName());



    }
}
